package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/supplier")
public class SupplierController {
    @Autowired
    private SupplierService supplierService;
    //获取供应商列表
    @PostMapping("/list")
    public Map<String,Object> supplierList(Integer page, Integer rows, String supplierName){
     Map<String,Object> result=supplierService.supplierList(page,rows,supplierName);
     return result;
    }

    //添加或修改供应商
    @PostMapping("/save")
    public ServiceVO saveOrUpdate(Integer supplierId, Supplier supplier){
     return supplierService.saveOrUpdate(supplierId,supplier);
    }

    //删除供应商
    @PostMapping("/delete")
    public ServiceVO delete(String ids){
        return supplierService.delete(ids);
    }
}
